/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FRC2856.Robot;

import edu.wpi.first.wpilibj.Dashboard;
import edu.wpi.first.wpilibj.DriverStation;

/**
 *
 * @author ngawlik
 */
public class DashComm {
    public Dashboard db;
    public DriverStation ds;
    public DriveTrain dt;
    public Shooter cannon;
    public Capture capture;

    public DashComm(DriveTrain driveTrain, Shooter shooter, Capture cap){
        ds = DriverStation.getInstance();
        db = ds.getDashboardPackerHigh();
        dt = driveTrain;
        cannon = shooter;
        capture = cap;
    }
    
    public void update(){
        double[] array;
        db.addCluster();
            
            db.addCluster(); // Drivetrain
                db.addDouble(dt.getGyro());
                db.addArray();
                    array = dt.getEncoderDist();
                    db.addDouble(array[0]);
                    db.addDouble(array[1]);
                db.finalizeArray();
                db.addArray();
                    array = dt.getEncoderRate();
                    db.addDouble(array[0]);
                    db.addDouble(array[1]);
                db.finalizeArray();
                db.addArray();
                    array = dt.getPID();
                    db.addDouble(array[0]);
                    db.addDouble(array[1]);
                db.finalizeArray();                
            db.finalizeCluster();
            
            db.addCluster(); // Ball Sensors
                boolean[] sensorStatus = capture.getSensorStatus();

                db.addBoolean(sensorStatus[0]);
                db.addBoolean(sensorStatus[1]);
                db.addBoolean(sensorStatus[2]);
            db.finalizeCluster();
            
            db.addCluster(); // Shooter
                db.addArray();
                    array = cannon.getEncoderDist();
                    db.addDouble(array[0]);
                    db.addDouble(array[1]);
                db.finalizeArray();
                db.addArray();
                    array = cannon.getEncoderRate();
                    db.addDouble(array[0]);
                    db.addDouble(array[1]);
                db.finalizeArray();
                db.addArray();
                    array = cannon.getPID();
                    db.addDouble(array[0]);
                    db.addDouble(array[1]);
                db.finalizeArray();                
            db.finalizeCluster();
        
        db.finalizeCluster();
        db.commit();
    }
}
